package com.fanrui.code.chess;

import com.fanrui.code.player.Player;
import com.fanrui.proto.cmd.NotityPlayerLeaveMahjongDesk;
import com.fanrui.proto.cmd.ResJoinMahjongRoom;
import com.fanrui.proto.cmd.ResPlayerLeaveMahjongDesk;
import com.google.protobuf.Message;
import com.google.protobuf.MessageLite;

/**
 * 一个桌子接口
 * @author Administrator
 *
 */
public interface ITable {
	
	/**
	 * 获取房间ID
	 * @return
	 */
	int getID();
	
	/**
	 * 进入
	 * @param player
	 * @return
	 */
	ResJoinMahjongRoom.Result enter(Player player);
	
	/**
	 * 解散
	 */
	void destory();
	
	/**
	 * 离开
	 * @param playerID
	 * @param result
	 * @return
	 */
	ResPlayerLeaveMahjongDesk.Result exit(long playerID,NotityPlayerLeaveMahjongDesk.Result result);
	
	/**  
	*  table信息
	*  @return    
	*  String    
	*/  
	String tableInfo();

	/**
	 * 广播命令
	 * 
	 * @param message
	 *            void
	 */
	void broadcast(MessageLite message);
	
	void broadcastExclude(MessageLite message,long playerID);

	Message toCmd();

	void playerReady(IChessGamer<?> gamer);

}
